package co.edu.usbcali.sgi.modelo.dto;

import co.edu.usbcali.sgi.modelo.Parametros;
import co.edu.usbcali.sgi.presentation.backEndBeans.ParametrosView;

import java.io.Serializable;

import java.util.Date;

import javax.faces.event.ActionEvent;


/**
*
*
* @author Zathura Code Generator http://code.google.com/p/zathura
*
*/
public class ParametrosDTO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String parValor1;
    private String parValor2;
    private String parCod;
    private boolean rowSelected = false;
    private ParametrosView parametrosView;
    private Parametros parametros;

    public Parametros getParametros() {
        return parametros;
    }

    public String listener_update(ActionEvent e) {
        try {
            parametrosView.action_modifyWitDTO(((parCod == null) ||
                parCod.equals("")) ? null : new String(parCod),
                ((parValor1 == null) || parValor1.equals("")) ? null
                                                              : new String(
                    parValor1),
                ((parValor2 == null) || parValor2.equals("")) ? null
                                                              : new String(
                    parValor2));
            rowSelected = !rowSelected;
        } catch (Exception ex) {
            return "";
        }

        return "";
    }

    public void listener_cancel(ActionEvent e) {
        parCod = parametros.getParCod().toString();
        parValor1 = (parametros.getParValor1() != null)
            ? parametros.getParValor1().toString() : null;
        parValor2 = (parametros.getParValor2() != null)
            ? parametros.getParValor2().toString() : null;
        rowSelected = !rowSelected;
    }

    /**
    * <p>Bound to commandLink actionListener in the ui that renders/unrenders
        * the Customer details for editing.</p>
        */
    public void toggleSelected(ActionEvent e) {
        parCod = parametros.getParCod().toString();
        parValor1 = (parametros.getParValor1() != null)
            ? parametros.getParValor1().toString() : null;
        parValor2 = (parametros.getParValor2() != null)
            ? parametros.getParValor2().toString() : null;
        rowSelected = !rowSelected;
    }

    public void setParametros(Parametros parametros) {
        this.parametros = parametros;
    }

    public ParametrosView getParametrosView() {
        return parametrosView;
    }

    public void setParametrosView(ParametrosView parametrosView) {
        this.parametrosView = parametrosView;
    }

    public String getParValor1() {
        return parValor1;
    }

    public void setParValor1(String parValor1) {
        this.parValor1 = parValor1;
    }

    public String getParValor2() {
        return parValor2;
    }

    public void setParValor2(String parValor2) {
        this.parValor2 = parValor2;
    }

    public String getParCod() {
        return parCod;
    }

    public void setParCod(String parCod) {
        this.parCod = parCod;
    }

    public boolean isRowSelected() {
        return rowSelected;
    }

    public void setRowSelected(boolean rowSelected) {
        this.rowSelected = rowSelected;
    }
}
